home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 575 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: kbad.eglin.af.mil!rpi!not-for-mail
  2. From: bernardi@mathp6.jussieu.fr (Dominique Bernardi)
  3. Newsgroups: comp.lang.c++.moderated,comp.lang.c++
  4. Subject: Re: Meaning of the specifier volatile?
  5. Date: 4 Jan 1996 19:08:26 -0000
  6. Organization: Universiti Pierre & Marie Curie
  7. Sender: cppmods@netlab.cs.rpi.edu
  8. Approved: Dietmar.Kuehl@uni-konstanz.de
  9. Message-ID: <4ch8ja$lj7@netlab.cs.rpi.edu>
  10. References: <4c9740$27n@netlab.cs.rpi.edu> <4cff74$gfj@netlab.cs.rpi.edu>
  11. NNTP-Posting-Host: netlab.cs.rpi.edu
  12.  
  13. X-Original-Date: Thu, 04 Jan 1996 16:09:37 +0100
  14.  
  15. In article (Dans l'article) <4cff74$gfj@netlab.cs.rpi.edu>,
  16. rmartin@oma.com (Robert C. Martin) wrote (=E9crivait)=A0:
  17.  
  18. <Snip>
  19.  
  20. >int * volatile tty =3D 0x100;  // 0x100 is the addr of the tty device.
  21. >
  22. >*tty =3D 'h'; // prints a 'c' on the tty;
  23. >
  24. >void PrintMessage(char *s)
  25. >{
  26. >  for(; *s; s++) *tty =3D *s; // prints the string on the tty.
  27. >}
  28. >
  29.  
  30. I would have written
  31.  
  32. volatile int * tty =3D 0x100;  // 0x100 is the addr of the tty device.
  33.  
  34. instead. The meaning is *not* the same.
  35. --=20
  36. Dominique Bernardi, Theorie des Nombres
  37. Universite Pierre et Marie Curie
  38. 4 place Jussieu - F75005 Paris Tel (33-1) 44275441
  39. bernardi@mathp6.jussieu.fr
  40.  
  41.     [ comp.lang.c++.moderated is a moderated newsgroup.  Submit articles ]
  42.     [  to <c++-submit@netlab.cs.rpi.edu>.  The moderation policy can be  ]
  43.     [   retrieved from <http://netlab.cs.rpi.edu/~cppmods/guide.html>.   ]
  44.     [    Moderators can be reached at: c++-request@netlab.cs.rpi.edu.    ]
  45.